<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增商品专题')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-subject-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">专题</label>
            <input name="productId" type="hidden" th:value="${productId}">
            <div class="col-sm-8">
                <select class="form-control" name="subjectId">
                    <option value="">请选择专题</option>
                    <option th:each="subject : ${subjectList}" th:value="${subject.id}"
                            th:text="${subject.title}"></option>
                </select>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script type="text/javascript">
    var prefix = ctx + "mall/relation"
    $("#form-subject-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            // $.operate.save(prefix + "/add", $('#form-subject-add').serialize());
            $.post(prefix + "/add", $('#form-subject-add').serialize(), function (result) {
                if (result.code == web_status.SUCCESS) {
                    $.modal.alertSuccess("操作成功")
                } else {
                    $.modal.alertError("请不要重复添加");
                }
                $.modal.closeLoading();
            });
        }
    }
</script>
</body>
</html>
